#ifndef TABBUTTONSPANEL_H
#define TABBUTTONSPANEL_H
#include <QWidget>
#include <QList>
#include <QVariant>

class QPushButton;

namespace ExecTerminalImplNS
{
    class TabButton;
    class TabButtonsPanel: public QWidget
    {
        Q_OBJECT
    public:
        TabButtonsPanel(QWidget * parent);

        int buttonsHeight()const;
        void setButtonsHeight(int aHeight);
        int buttonsSpacing()const;
        void setButtonsSpacing(int aSpacing);
        int minimumVertMargin()const;
        void setMinimumVertMargin(int aMargin);
        int horMargin()const;
        void setHorMargin(int aMargin);

        QByteArray saveState()const;
        void restoreState(const QByteArray & );

    signals:
        void tabClosed(int index, QVariant data);
        void currentChanged(int index, QVariant data);
        void tabDeleting(QVariant data);

    protected slots:
        void moveUp();
        void moveDown();

        void updateCurrentIndex(const QVariant & data);
        void removeDeletingTab(QVariant data);

    protected:
        void paintEvent(QPaintEvent *);
        void resizeEvent(QResizeEvent *);
        void initLayoutButtons();
        void layoutButtons();
        void updateMinimumHeight();
        void checkedSetValue(int * val, int newVal);
        void updateVisibleButtons();
        void updateScrollBottonsEnabledState();

    private:
        QList<TabButton*> theTabButtons;
        QPushButton * theTopButton;
        QPushButton * theBottomButton;
        int theFirstVisibleNumber;
        int theVisibleCount;
        int theCurrentNumber;
        int theButtonsHeight;
        int theButtonsSpacing;
        int theMinimumVertMargin;
        int theHorMargin;
    };
}
#endif


